﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using Wuliu.SDK.Core.Model;
using Wuliu.SDK.Core.RequestBuilder;

namespace Wuliu.SDK.Core.Client
{
    public class DeBangClient
    {
        private const string DEFAULT_HOST = "http://dpsanbox.deppon.com";
       
        private DeBangUrlBuilder _urlBuilder;

        public DeBangClient(string accessKey, string companyCode, string host = DEFAULT_HOST)
        {
            _urlBuilder = new DeBangUrlBuilder(accessKey,companyCode,host);
        }

       

        public async Task<NewTraceQueryResponse> GetTraceQuery(NewTraceQuery request)
        {
            string url = "http://dpsanbox.deppon.com/sandbox-web/standard-order/newTraceQuery.action";

            url = _urlBuilder.Build(url, request.ToJson());

            return await HttpRequest.PostAsync<NewTraceQueryResponse>(url);
        }

        public async Task<RespStandTraceSubscribe> GetStandTraceSubscribe(StandTraceSubscribe request)
        {
            string url = "http://dpsanbox.deppon.com/sandbox-web/standard-order/standTraceSubscribe.action";

            url = _urlBuilder.Build(url, request.ToJson());
           
            return await HttpRequest.PostAsync<RespStandTraceSubscribe>(url);
        }


    }

    
}
